//
// C++ Interface: activity
//
// Description:
//
//
// Author: Willi Ballenthin <wilbal1087@gmail.com>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef ACTIVITY_H
#define ACTIVITY_H

#include "activitydbinterface.h"

#include <QObject>
#include <QtCore>
#include <QtSql>

class ActivityDbInterface;

/**
* A class representing an athletic activity, that took
* place over a period of time, on some day, etc.  This
* class should be subclassed for each backend database
* scheme, implementing insert, modify, query, etc.
    @author Willi Ballenthin <wilbal1087@gmail.com>
*/
class Activity
{
    public:
        Activity ( ActivityDbInterface* query = 0 );
        Activity ( const Activity& act );
        Activity& operator= ( const Activity& act );

        // this is the official order of members
        // when relevant, ie indices
        QDate   getDate();
        QTime   getTime();
        QTime   getDuration();
        float   getDistance();
        int     getEffort();
        QString getType();
        QString getLocation();
        QString getRoute();
        QString getNotes();
        QString getSplits();
        int     getId();


        void setDate ( QDate );
        void setTime ( QTime );
        void setDuration ( QTime );
        void setDistance ( float );
        void setEffort ( int );
        void setType ( QString );
        void setLocation ( QString );
        void setRoute ( QString );
        void setNotes ( QString );
        void setSplits ( QString );
        void setId ( int );

        bool insert ();
        bool discard();

        enum ActivityStates { NEW = 0, EXISTING = 1, DELETED = -1  };



    protected:
        /// The date on which the activity took place.
        QDate   date;
        /// The time of day at which the activity took place.
        QTime   time;
        /// The duration of the activity.
        QTime   duration;
        /// The distance of the activity, if it has one.
        float   distance;
        /// Where the activity took place. ie. City, State.
        QString location;
        /// The type of activity, like a run or walk.
        QString type;
        /// The route taken, if applicable. Syntax is not yet defined.
        QString route;
        /// Any notes regarding the activity.
        QString notes;
        /// Splits recorded from the activity, if applicable.
        /// The syntax is not yet defined.
        QString splits;
        /// The effort put into the activity, ranging from
        /// 0-10
        int     effort;
        /// An id of the activity, set by the database.
        /// This should not be modified.
        int     id;
        ActivityDbInterface* query;

        QSqlQuery* sql;

};

#endif
